import { Object3D } from './Object3D'
import { Vector3 } from '../Math/Vector3'
import { getStream } from '../Core/connect'
import { Material } from '../Material/Material'
 
export class GeojsonLine extends Object3D {
    readonly type: string
    material: Material
    width: number
    constructor(name: string, material: Material, width = 10000) {
        super({name: name, type: 'GeojsonLine'})
        this.type = 'GeojsonLine'
        this.width = width
        this.material = material
    }
    buildLine(pointList:Array<Vector3>){
        const stream = getStream()
        const str = {GeojsonLineFunction: 'buildLine', ids: `${this.uuid}`, width: this.width, pointList:pointList, material: this.material.getJson()}
        stream.emitUIInteraction(str)
    }
    setMaterial(material: Material){
        this.material = material
        const stream = getStream()
        const str={GeojsonLineFunction:'setGeojsonLineMaterial',ids:`${this.uuid}`,material: material.getJson()}
        stream.emitUIInteraction(str)
    }
    setWidth(width: number){
        this.width = width
    }
}